perm filename BLOB.XGP[W76,JMC]2 blob
sn#265463 filedate 1977-02-19 generic text, type T, neo UTF8
/LMAR=0/XLINE=3/FONT#0=BAXL30/FONT#1=BAXM30/FONT#2=BAXB30/FONT#3=SUB/FONT#4=SUP/FONT#5=BASL35/FONT#6=NGR25/FONT#7=MATH30/FONT#8=FIX25/FONT#9=GRKB30
␈↓ ↓H␈↓Flow Chart Functions␈↓ ε(␈↓εDraft␈↓␈↓ H
␈↓ ↓H␈↓α␈↓ ∧λTHE BLOB FUNCTIONS OF FLOW CHARTS
␈↓ ↓H␈↓␈↓ α_When␈αone␈α
studies␈αprograms␈α
organized␈α as␈α
flow␈αcharts,␈α
one␈αis␈α
inclined␈αto␈α
prefer␈αflow␈α
charts
␈↓ ↓H␈↓with␈αa␈αsingle␈αentry␈αand␈αa␈αsingle␈αexit.␈α However,␈αthe␈αoperations␈αof␈αbuilding␈αflow␈αcharts␈αfrom␈αparts
␈↓ ↓H␈↓inevitably involve flow charts with multiple entries and multiple exits.
␈↓ ↓H␈↓␈↓ α_Our␈α approach␈α is␈α to␈α characterize␈αflow␈α charts␈α by␈α certain␈αfunctions,␈αcalled␈α␈↓↓blob␈αfunctions␈↓,
␈↓ ↓H␈↓and␈αshow␈αhow␈αto␈αget␈α the␈αfunctions␈αcharacterizing␈αnew␈αflow␈αcharts␈αfrom␈αthose␈αcharacterizing␈α the
␈↓ ↓H␈↓flow␈α∂charts␈α∞from␈α∂which␈α∞ the␈α∂new␈α∞ones␈α∂are␈α∞formed.␈α∂ This␈α∞is␈α∂in␈α∞contrast␈α∂with␈α∞ the␈α∂approach␈α∞of
␈↓ ↓H␈↓Ianov␈αas␈αdescribed␈αin␈α(Ianov␈α1959)␈α and␈α(Rutledge␈α1964)␈αwho␈αwork␈αdirectly␈αwith␈αthe␈α
flow␈αcharts.
␈↓ ↓H␈↓Our␈α∃reason␈α∃is␈α⊗ that␈α∃mathematics␈α∃ provides␈α∃ us␈α⊗ with␈α∃ powerful␈α∃ tools␈α⊗ for␈α∃ manipulating
␈↓ ↓H␈↓functions,␈α∞ and,␈α∞moreover,␈α∂facts␈α∞ about␈α∞flow␈α∞charts␈α∂ must␈α∞be␈α∞combined␈α∞with␈α∂other␈α∞mathematical
␈↓ ↓H␈↓facts which are most conveniently decribed in terms of functions, predicates and sets.
␈↓ ↓H␈↓␈↓ ε⊃Figure 1
␈↓ ↓H␈↓α1. Blob functions
␈↓ ↓H␈↓␈↓ α_Figure␈α1a␈αrepresents␈αa␈αflow␈αchart␈αor␈α␈↓↓blob␈↓␈α␈↓↓c␈↓␈αwhose␈αinner␈αworkings␈αwe␈αdo␈αnot␈αwish␈αto␈αspecify,
␈↓ ↓H␈↓but␈α∂whose␈α⊂behavior␈α∂we␈α⊂wish␈α∂to␈α⊂characterize␈α∂by␈α∂functions.␈α⊂ The␈α∂arrows␈α⊂into␈α∂the␈α⊂␈↓↓blob␈↓␈α∂represent
␈↓ ↓H␈↓paths␈α
along␈α
which␈αcontrol␈α
enters␈α
the␈α
flow␈αchart␈α
(called␈α
entries),␈α
and␈αthe␈α
arrows␈α
out␈αrepresent␈α
paths
␈↓ ↓H␈↓by␈αwhich␈αcontrol␈αleaves␈αit␈α(called␈α␈↓↓exits).␈↓␈α Let␈α␈↓↓En(c)␈↓␈αbe␈αthe␈αset␈αof␈αentries␈αof␈α␈↓↓c,␈↓␈αand␈αlet␈α␈↓↓Ex(c)␈↓␈αbe␈αits
␈↓ ↓H␈↓set␈α∞of␈α∞exits.␈α∞ Let␈α∞␈↓↓x␈↓␈α∞represent␈α∞the␈α∞state␈α∂vector,␈α∞i.e.␈α∞ the␈α∞collection␈α∞of␈α∞assignments␈α∞of␈α∞values␈α∂to␈α∞the
␈↓ ↓H␈↓variables␈αoccurring␈α
in␈αthe␈α
program.␈α We␈α
define␈αpredicates␈α
␈↓↓p␈↓βij␈↓↓(x,c)␈↓␈αwhere␈α
␈↓↓i␈↓␈αranges␈α
over␈α␈↓↓En(c)␈↓␈αand␈α
␈↓↓j␈↓
␈↓ ↓H␈↓ranges over ␈↓↓Ex(c)␈↓, and functions ␈↓↓s␈↓βi␈↓␈↓↓(x,c)␈↓ where ␈↓↓i␈↓ again ranges over ␈↓↓En(c)␈↓ as follows:
␈↓ ↓H␈↓␈↓ α_(i)␈α␈↓↓p␈↓βij␈↓␈↓↓(x,c)␈↓␈αis␈α true␈αif␈αand␈α only␈αif␈αentering␈αthe␈α flow␈αchart␈α␈↓↓c␈↓␈α at␈αentry␈α␈↓↓i␈↓␈α with␈αinitial␈α
state␈α ␈↓↓x␈↓
␈↓ ↓H␈↓results in leaving the flow chart at exit ␈↓↓j␈↓.
␈↓ ↓H␈↓␈↓ α_(ii)␈α␈↓↓s␈↓βi␈↓␈↓↓(x,c)␈↓␈αis␈αthe␈αvalue␈αof␈αthe␈αstate␈αat␈αexit␈αfrom␈α the␈αflow␈αchart␈αwhen␈αit␈αis␈αentered␈αat␈α␈↓↓i␈↓␈αwith
␈↓ ↓H␈↓initial state ␈↓↓x.␈↓ Note that the ␈↓↓s␈↓βi␈↓'s are partial functions, because the program may never exit.
␈↓ ↓H␈↓␈↓ α_Obviously␈α
the␈α
predicates␈α
␈↓↓p␈↓βij␈↓␈α∞and␈α
the␈α
functions␈α
␈↓↓s␈↓βi␈↓␈α
characterize␈α∞the␈α
flow␈α
chart␈α
␈↓↓c,␈↓␈α∞because␈α
if
␈↓ ↓H␈↓one␈αknows␈α
these,␈αone␈α
knows␈αwhere␈α
the␈αprogram␈α
will␈αexit␈α
and␈αwhat␈α
the␈αnew␈α
state␈αwill␈α
be␈αfor␈α
any
␈↓ ↓H␈↓entrance into the flow chart.
␈↓ ↓H␈↓␈↓ α_If␈α⊂ we␈α⊂suppose␈α⊂that␈α⊂the␈α⊂flow␈α⊂ chart␈α⊂is␈α⊂ultimately␈α⊂constructed␈α⊂out␈α⊂of␈α⊃elementary␈α⊂compute
␈↓ ↓H␈↓blocks␈α
and␈α
elementary␈α∞ decision␈α
blocks␈α
as␈α∞in␈α
Figure␈α
1b,␈α
one␈α∞needs␈α
to␈α
show␈α∞how␈α
to␈α
write␈α∞the␈α
␈↓↓p␈↓'s
␈↓ ↓H␈↓and␈α
␈↓↓s␈↓'s␈α∞for␈α
these␈α
elements␈α∞and␈α
then␈α∞ how␈α
to␈α
get␈α∞the␈α
␈↓↓p␈↓'s␈α∞and␈α
␈↓↓s␈↓'s␈α
for␈α∞ a␈α
combination␈α∞ of␈α
blocks
␈↓ ↓H␈↓Flow Chart Functions␈↓ ε(␈↓εDraft␈↓␈↓ 91
␈↓ ↓H␈↓from␈α
those␈αof␈α
its␈α parts.␈α
The␈αfirst␈α
part␈αis␈α
trivial.␈α A␈α
compute␈αblock␈α
has␈αjust␈α
one␈α
entry␈αand
␈↓ ↓H␈↓one␈αexit,␈α so␈αthere␈αis␈αjust␈αone␈α␈↓↓p␈↓␈αand␈αit␈αis␈αidentically␈α true,␈αand␈αthere␈αis␈α just␈αone␈α␈↓↓s,␈↓␈αand␈αit␈α is␈αjust
␈↓ ↓H␈↓the␈α function␈α
of␈αstate␈α
computed␈α by␈αthe␈α
block.␈α A␈α
decision␈αblock␈αhas␈α
one␈α entry␈α
and␈αtwo␈αexits␈α
and
␈↓ ↓H␈↓the␈α
one␈α
␈↓↓p␈↓␈αis␈α
just␈α
the␈αpredicate␈α
for␈α
the␈αYES␈α
decision␈α
and␈αthe␈α
other␈α
is␈αthe␈α
predicate␈α
for␈α
the␈αNO
␈↓ ↓H␈↓decision. There is one ␈↓↓s,␈↓ and it is the identity function.
␈↓ ↓H␈↓Flow Chart Functions␈↓ ε(␈↓εDraft␈↓␈↓ 92
␈↓ ↓H␈↓␈↓ α_We introduce the following operations that give new charts from old ones:
␈↓ ↓H␈↓␈↓ ε⊃Figure 2
␈↓ ↓H␈↓␈↓ α_(i)␈α∂Suppression␈α∂of␈α∂an␈α∂entry␈α∂␈↓↓i␈↓β0␈↓␈α∂ from␈α∂a␈α∂chart␈α∂␈↓↓c␈α∂(see␈↓␈α∂Figure␈α∂2a).␈α∂ This␈α∂gives␈α∂a␈α⊂new␈α∂chart
␈↓ ↓H␈↓␈↓↓suppress(c,i␈↓β0␈↓↓)␈↓␈α
with␈α
one␈α
fewer␈αentry,␈α
and␈α
whose␈α
␈↓↓p␈↓'s␈αand␈α
␈↓↓s␈↓'s␈α
are␈α
the␈αsame␈α
as␈α
before␈α
except␈αthat␈α
the
␈↓ ↓H␈↓subscript ␈↓↓i␈↓β0␈↓ is omitted.
␈↓ ↓H␈↓␈↓ α_(ii)␈α⊂Adjoining␈α∂two␈α⊂charts␈α∂␈↓↓c1␈↓␈α⊂and␈α∂ ␈↓↓c2␈↓␈α⊂side␈α⊂by␈α∂side␈α⊂(see␈α∂Figure␈α⊂2b).␈α∂ Call␈α⊂ the␈α⊂new␈α∂ chart
␈↓ ↓H␈↓␈↓↓adjoin(c1,c2)␈↓.␈α
We␈α
have␈α
␈↓↓En(adjoin(c1,c2))␈α
=␈α
En(c1)␈α∪␈α
En(c2)␈↓,␈α
and␈α
␈↓↓Ex(adjoin(c1,c2))␈α
=␈α
Ex(c1)␈α∪
␈↓ ↓H␈↓↓Ex(c2)␈↓. Moreover, we have
␈↓ ↓H␈↓1)␈↓ α8␈α∞ ␈↓↓p␈↓βij␈↓↓(x,adjoin(c1,c2))␈α∞=␈α
␈↓αif␈↓↓␈α∞i␈α∞ε␈α
c1␈α∞␈↓αthen␈↓↓␈α∞(␈↓αif␈↓↓␈α∞j␈α
ε␈α∞c1␈α∞␈↓αthen␈↓↓␈α
p␈↓βij␈↓↓(x,c1)␈α∞␈↓αelse␈↓↓␈α∞␈↓αfalse␈↓↓)␈α
␈↓αelse␈↓↓␈α∞(␈↓αif␈↓↓␈α∞j␈α∞ε␈α
c1
␈↓ ↓H␈↓↓␈↓αthen␈↓↓ ␈↓αfalse␈↓↓ ␈↓αelse␈↓↓ p␈↓βij␈↓↓(x,c2))␈↓,
␈↓ ↓H␈↓and
␈↓ ↓H␈↓2)␈↓ α8 ␈↓↓s␈↓βi␈↓↓(x,adjoin(c1,c2)) = ␈↓αif␈↓↓ i ε c1 ␈↓αthen␈↓↓ s␈↓βi␈↓↓(x,c1) ␈↓αelse␈↓↓ p␈↓βi␈↓↓(x,c2)␈↓.
␈↓ ↓H␈↓Both of these are trivial operations but the next is not.
␈↓ ↓H␈↓␈↓ α_(iii)␈α∞Connecting␈α
the␈α∞exit␈α∞ ␈↓↓m␈↓␈α
to␈α∞the␈α
entry␈α∞ ␈↓↓n␈↓␈α∞giving␈α
a␈α∞ new␈α
chart␈α∞ ␈↓↓loop(c,m,n)␈↓␈α∞with␈α
one
␈↓ ↓H␈↓fewer exit (see Figure 2c). The new ␈↓↓p␈↓'s and ␈↓↓s␈↓'s are defined by the recursion equations
␈↓ ↓H␈↓3)␈↓ α8 ␈↓↓p␈↓βij␈↓↓(x,loop(c,m,n)) ← p␈↓βij␈↓↓(x,c) ∨ (p␈↓βim␈↓↓(x,c) ∧ p␈↓βnj␈↓↓(s␈↓βi␈↓↓(x,c),loop(c,m,n)))␈↓
␈↓ ↓H␈↓and
␈↓ ↓H␈↓4)␈↓ α8 ␈↓↓s␈↓βi␈↓↓(x,loop(c,m,n)) ← ␈↓αif␈↓↓ ¬p␈↓βim␈↓↓(x,c) ␈↓αthen␈↓↓ s␈↓βi␈↓↓(x,c) ␈↓αelse␈↓↓ s␈↓βn␈↓↓(s␈↓βi␈↓↓(x,c),loop(c,m,n))␈↓.
␈↓ ↓H␈↓Flow Chart Functions␈↓ ε(␈↓εDraft␈↓␈↓ 93
␈↓ ↓H␈↓␈↓ α_A␈αlittle␈αcontemplation␈αwill␈αshow␈αthat␈αthis␈αrecursive␈αprocess␈αcaptures␈αour␈αintuitive␈α
notion␈αof
␈↓ ↓H␈↓what happens when an exit is connected to an entry.
␈↓ ↓H␈↓␈↓ α_It␈αis␈αevident␈αthat␈αany␈αflow␈αchart␈α
can␈αbe␈αbuilt␈αfrom␈αelementary␈αcompute␈αblocks␈αand␈α
tests␈αby
␈↓ ↓H␈↓these␈α∃operations,␈α∀and␈α∃furthermore␈α∃any␈α∀two␈α∃flow␈α∀charts␈α∃can␈α∃be␈α∀glued␈α∃together␈α∃using␈α∀these
␈↓ ↓H␈↓operations.
␈↓ ↓H␈↓␈↓ α_An␈α⊂objective␈α∂worth␈α⊂undertaking␈α⊂is␈α∂to␈α⊂show␈α⊂that␈α∂any␈α⊂two␈α⊂equivalent␈α∂flow␈α⊂charts␈α⊂can␈α∂be
␈↓ ↓H␈↓proved␈α∂equivalent␈α∂by␈α⊂the␈α∂theory␈α∂of␈α∂recursively␈α⊂defined␈α∂functions␈α∂from␈α∂these␈α⊂definitions.␈α∂ This
␈↓ ↓H␈↓would␈α⊂be␈α⊂the␈α⊂analog␈α⊂of␈α⊃Ianov's␈α⊂theorem␈α⊂and␈α⊂ought␈α⊂to␈α⊃be␈α⊂based␈α⊂on␈α⊂a␈α⊂decision␈α⊃procedure␈α⊂for
␈↓ ↓H␈↓recursions␈α
(possibly␈α
restricted␈αto␈α
iterative␈α
form)␈α
where␈αthere␈α
is␈α
only␈αone␈α
variable.␈α
It␈α
would␈αhave
␈↓ ↓H␈↓the␈αadvantage␈αover␈αthe␈αIanov␈αtheory␈αthat␈αit␈α
is␈αsimply␈αthe␈αtheory␈αof␈αrecursion␈αequations␈αapplied␈α
to
␈↓ ↓H␈↓this case rather than an ad hoc confection.
␈↓ ↓H␈↓␈↓ α_I␈α
don't␈α
know␈α
such␈α
a␈α
decision␈α
procedure,␈αnor␈α
has␈α
there␈α
been␈α
formulated␈α
a␈α
theory␈αof␈α
recursion
␈↓ ↓H␈↓equations that is proved complete for this case.
␈↓ ↓H␈↓Note of February 19, 1977:
␈↓ ↓H␈↓␈↓ α_The␈α⊂recursion␈α∂involved␈α⊂when␈α∂an␈α⊂exit␈α∂is␈α⊂connected␈α∂to␈α⊂an␈α∂entry␈α⊂can␈α∂be␈α⊂represented␈α⊂by␈α∂a
␈↓ ↓H␈↓␈↓↓functional equation␈↓ and a ␈↓↓minimization schema␈↓ as discussed in (McCarthy 1977).
␈↓ ↓H␈↓␈↓ α_If␈αtwo␈αexits␈αof␈αa␈αchart␈αare␈αconnected␈αto␈αtwo␈αentries,␈αthis␈αcan␈αbe␈αdone␈αin␈αtwo␈αdifferent␈α
orders
␈↓ ↓H␈↓-␈αthus␈αgiving␈αrise␈αto␈αtwo␈αsets␈αof␈αrecursions␈αfor␈αthe␈αnew␈αchart.␈α Moreover,␈αa␈αthird␈αset␈αof␈αrecursions
␈↓ ↓H␈↓can␈αbe␈αobtained␈αby␈αdoing␈αthe␈αconnections␈αsimultaneously.␈α It␈αshould␈αbe␈αpossible␈αto␈αshow␈αfrom␈αthe
␈↓ ↓H␈↓␈↓↓functional␈α⊃equations␈↓␈α⊃and␈α⊃␈↓↓minimization␈α⊃schemas␈↓␈α⊃of␈α⊂these␈α⊃recursions␈α⊃that␈α⊃the␈α⊃same␈α⊃funtions␈α⊂are
␈↓ ↓H␈↓obtained.
␈↓ ↓H␈↓αREFERENCES
␈↓ ↓H␈↓␈↓αIanov,␈α
Y.I.␈↓␈α
(1960):␈α
"The␈α
Logical␈α
Schemes␈α
of␈α
Algorithms",␈α
in␈α
␈↓↓␈α
Problems␈α
of␈α
Cybernetics␈↓,␈α
vol.1,␈αpp.␈α
82-
␈↓ ↓H␈↓140, Pergamon Press, New York (English Translation).
␈↓ ↓H␈↓␈↓αRutledge, J.D.␈↓ (1964): "On Ianov's Program Schemata", ␈↓↓J. ACM␈↓, ␈↓α11␈↓(1): 1-9 (January).
␈↓ ↓H␈↓John McCarthy
␈↓ ↓H␈↓Artificial Intelligence Laboratory
␈↓ ↓H␈↓Computer Science Department
␈↓ ↓H␈↓Stanford University
␈↓ ↓H␈↓Stanford, California 94305
␈↓ ↓H␈↓ARPANET: MCCARTHY@SU-AI
␈↓ ↓H␈↓␈↓εThis draft of BLOB[W76,JMC] PUBbed at 12:45 on February 19, 1977.␈↓